package supermaket;

import java.util.HashSet;
import java.util.Scanner;

public class Test{
    public static final Scanner input = new Scanner(System.in);
    public static HashSet<UserInfo> u = new HashSet<>();
    static {
        u.add(new UserInfo(1001,"冯程程","铂金卡",2000,"合法账户"));
        u.add(new UserInfo(1002,"王大锤","钻石卡",5000,"被禁账户"));
        u.add(new UserInfo(1003,"张巧巧","金卡",500,"合法账户"));
    }
    public static void main(String[] args) {
        System.out.println("================欢迎来到超市管理系统================");
        System.out.println("1.查询会员信息");
        System.out.println("2.删除会员信息");
        System.out.println("3.添加会员信息");
        System.out.println("4.修改会员积分");
        System.out.println("5.退出");
        int choice = input.nextInt();
        while (true) {
            switch (choice) {
                case 1:
                    findAll();
                    break;
                case 2:

                    break;
                case 3:

                    break;
                case 4:

                    break;
                case 5:
                    System.out.println("欢迎下次光临");
                    break;
                default:
                    System.out.println("输入错误，请重新输入");
                    break;

            }
        }
    }
    //判断id是否存在
    public static boolean isExist(int id){
        for (UserInfo userInfo : u) {
            if (userInfo.getId() == id){
                return true;
            }
        }
        return false;
    }
    public static void findAll(){
        System.out.println("编号\t会员名称\t会员类型\t会员积分\t会员状态");
        //使用lambda表达式
        UserAdd userAdd = () -> {
            for (UserInfo userInfo : u) {
                System.out.println(userInfo);
            }
        };
    }
}
